#!/bin/bash
dataPoints=60
interval=50
count=0
bodies=0
newBodies=0

rm results.txt

while [ $count -lt $dataPoints ]
do
   cp cluster.py cluster_temp.py
   newBodies=`expr $bodies + $interval`
   (echo ',s/nBodies=0/nBodies='$newBodies; echo 'wq') | ed -s cluster_temp.py
   bodies=$newBodies
   python cluster_temp.py

   echo $bodies
   echo $bodies >> results.txt
   date  +'%s %N' >> results.txt
   ./nBody cluster.txt cluster.nbd # > setup.txt
   date  +'%s %N' >> results.txt
   echo >> results.txt

   rm cluster_temp.py
   rm setup.txt
   rm data/*

   ((count++))
done
